﻿using B.S.DataBase.MyProject.ErrorCode;
using B.S.Traceability.Domain;
using B.S.Traceability.Read.API.Applicantion.Command.BreedCommand;
using B.S.Traceability.Read.API.Applicantion.Command.EnterInfoCommand;
using B.S.Traceability.Read.API.Applicantion.Command.GoodsCommand;
using B.S.Traceability.Read.API.Applicantion.Command.HealthCommand;
using B.S.Traceability.Read.API.Applicantion.Command.PhoneCommand;
using B.S.Traceability.Read.API.Applicantion.Command.SlaughterInfoCommand;
using B.S.Traceability.Read.API.Applicantion.Command.SupplierCommand;
using B.S.Traceability.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Traceability.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManageController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManageController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 查询商品名称列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public Task<APIResult<List<SU_GoodName>>> GetGoodNameList([FromQuery]QueryGoodNameCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 查询商品列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<ApiPaging<GoodsDTO>> GetGoodList([FromQuery]QueryGoodsCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询养殖信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_BreedInfo>>> GetBreedInfoLsit([FromQuery] QueryBreedCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询保健信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_Health>>> GetHealthLsit([FromQuery] QueryHealthCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询公司信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_EnterInfo>>> GetEnter([FromQuery]QueryEnterInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询屠宰信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_SlaughterInfo>>> GetSlaughter([FromQuery] QuerySlaughterInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询图片信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_PhoneInfo>>> GetPhone([FromQuery] QueryPhoneCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 查询供应商信息列表
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<SU_Supplier>>> GetSupplier([FromQuery] QuerySupplierCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
